/*
 * Copyright (c) 2022-present Charles7c Authors. All Rights Reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package top.continew.admin.asset.mapper;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import org.apache.ibatis.annotations.Param;
import top.continew.admin.asset.model.resp.DeviceRecordsDetailResp;
import top.continew.admin.common.config.mybatis.DataPermissionMapper;
import top.continew.admin.asset.model.entity.DeviceRecordsDO;
import top.continew.starter.extension.datapermission.annotation.DataPermission;

import java.util.List;

/**
 * 设备清单 Mapper
 *
 * @author CharlieYan
 * @since 2025/03/18 10:12
 */
public interface DeviceRecordsMapper extends DataPermissionMapper<DeviceRecordsDO> {

    /**
     * 分页查询列表
     *
     * @param page         分页条件
     * @param queryWrapper 查询条件
     * @return 分页列表信息
     */
    @DataPermission(tableAlias = "tt")
    IPage<DeviceRecordsDetailResp> selectDeviceRecordsPage(@Param("page") IPage<DeviceRecordsDO> page,
                                                           @Param(Constants.WRAPPER) QueryWrapper<DeviceRecordsDO> queryWrapper);

    /**
     * 根据类型查询设备品牌
     *
     * @param categoryId
     * @return 设备品牌
     */
    List<String> selectDeviceBrandByCategoryId(@Param("categoryId") Long categoryId);

    /**
     * 根据类型查询设备型号
     *
     * @param categoryId
     * @return 设备型号
     */
    List<String> selectDeviceModelByCategoryId(@Param("categoryId") Long categoryId);

    /**
     * 根据设备编码查询数量
     *
     * @param code 手机号
     * @return 设备数量
     */
    Long selectCountByCode(@Param("code") String code);

}